-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(interpreter): use let else
#629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine but defer to dragan for the stylistical choice , know seitz doesn't like let else
Some(gas_used) => gas!($interp, gas_used), | ||
None => { | ||
Some(gas_used) if $interp.gas.record_cost(gas_used) => {} | ||
_ => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit any reason to not use the macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would duplicate the assign/return on both branches, doesn't really matter since compiler probably optimizes that anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this one, I slightly vary on the fn call side-effect inside if, and second reason is that gas!
is used everywhere so it converges to one place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
)* | ||
) | ||
($interp:expr, $($x:expr),* $(,)?) => ($( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now lets you push multiple values? or what is the new $(,)?
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just allows trailing comma. Sometimes rustfmt will add it and then parsing fails because it is not expected in the macro.
It also avoids unwrap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit for gas!
macro. Other things lgtm!
* chore(interpreter): use `let else` * use gas macro
* chore(interpreter): use `let else` * use gas macro
Split off from #582
And macros style changes.
Improves readability. MSRV for this feature is 1.65 but I see it's already present in
revm
.